import request from '@/utils/request';
import { UserAccountQuery, UserAccountVo, UserAccountForm } from './types';
import { AxiosPromise } from 'axios';

/** 查询用户账户列表 */
export function listUserAccount(query: UserAccountQuery): AxiosPromise<any> {
    return request({
        url: '/user/account/list',
        method: 'get',
        params: query
    });
}

/** 查询用户账户详细 */
export function getUserAccount(id: number): AxiosPromise<any> {
    return request({
        url: `/user/account/${id}`,
        method: 'get'
    });
}

/** 新增用户账户 */
export function addUserAccount(data: UserAccountForm): AxiosPromise<any> {
    return request({
        url: '/user/account',
        method: 'post',
        data: data
    });
}

/** 修改用户账户 */
export function updateUserAccount(data: UserAccountForm): AxiosPromise<any> {
    return request({
        url: '/user/account',
        method: 'put',
        data: data
    });
}

/** 删除用户账户 */
export function delUserAccount(ids: number[]): AxiosPromise<any> {
    return request({
        url: `/user/account/${ids}`,
        method: 'delete'
    });
}
